/*
 *the result view for the application
 * this class is responsible to show the clustring results
 */

/*
 * ViewResults.java
 *
 * Created on 06-Apr-2013, 01:50:43
 */

package clusteringgens;

import com.model.ClassBean;
import com.model.ExperimentBean;
import com.model.GeneBean;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Yehia Mokhtar
 */
public class ViewResults extends javax.swing.JFrame {

    /** Creates new form ViewResults */
    public ViewResults() {
       
        initComponents();
       // this.setSize(1100, 1100);
       
    }
    
    
    public void showResults(Map<Integer,List<ClassBean>> itrMap,ExperimentBean exp)
    {               
        jTextArea1.setText("iteration"+"\t"+"Sets Number"+"\t"+"Sets:"+"\n");
        for(int x:itrMap.keySet())
          {
               List<ClassBean> cList = itrMap.get(x);
               String l ="";
               for(ClassBean c:cList)
               {
                    l =l+(" [");
                    for(int z=0;z<c.getObjectSet().size();z++){//GeneBean gb:c.getObjectSet()){
                        GeneBean gb=c.getObjectSet().get(z);
                        if(c.getObjectSet().size()== 1||z == c.getObjectSet().size()-1)
                           l = l +gb.getGeneratedID()  ;
                        else
                            l = l+gb.getGeneratedID()+" , ";
                   }
                    l = l +("]");
               
               }
               String raw = jTextArea1.getText()+(x+1)+" :"+"\t"+"\t"+cList.size()+"\t"+"\t"+l;
               jTextArea1.setText(raw);
               jTextArea1.setText(jTextArea1.getText()+"\n");
                       
          }
         jTextArea2.setText("Generated ID"+"\t"+"Probe ID "+"\t"+"GeneID"+"\n");
         for(int x:exp.getGeneIdMap().keySet())
         {
             GeneBean gb = exp.getGeneIdMap().get(x);
             String raw = jTextArea2.getText()+"    "+gb.getGeneratedID()+"    "+"\t"+gb.getProbeID()+"    "+"\t"+gb.getGeneID()+"\n";
             jTextArea2.setText(raw);
         }

        
    
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(clusteringgens.ClusteringGensApp.class).getContext().getResourceMap(ViewResults.class);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jTextArea2.setName("jTextArea2"); // NOI18N
        jScrollPane3.setViewportView(jTextArea2);

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setName("jTextArea1"); // NOI18N
        jScrollPane1.setViewportView(jTextArea1);

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 714, Short.MAX_VALUE)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 714, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
                .addGap(590, 590, 590))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2)
                .addGap(17, 17, 17)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    // End of variables declaration//GEN-END:variables

}
